﻿
Ext.define('app.prm.inquiry.Search', {
    extend: 'Ext.panel.Panel',
    reference: 'inquirysearch',
    autoHeight: true,
    isTodo: false,
    initComponent: function () {
        var me = this;

        me.form = new Ext.form.Panel(
        {
            defaults: { anchor: '100%' },
            bodyStyle: 'padding:5px',
            defaultType: 'textfield',
            defaults: {
                anchor: '100%'
            },
            fieldDefaults: {
                labelWidth: 90,
                //labelAlign: "right",
                flex: 1,
                margin: 6
            },
            items: [
                {
                    fieldLabel: '项目编号',
                    name: 'ProjectNo'
                },
                {
                    fieldLabel: '项目名称',
                    name: 'ProjectName'
                },
                {
                    fieldLabel: '产品号',
                    name: 'ProductNo'
                },
                {
                    fieldLabel: '化学名',
                    name: 'SubName'
                },
                {
                    fieldLabel: 'CAS',
                    name: 'CAS'
                },
                {
                    fieldLabel: '客户名称',
                    name: 'CustomerName'
                }
                ,
                  {
                      fieldLabel: '负责人',
                      name: 'PMName'
                  }
                ,
                {
                    fieldLabel: '状态',
                    xtype: 'combo',
                    reference: 'statusCombo',
                    name: 'status',
                    triggerAction: 'all',
                    lazyRender: true,
                    mode: 'local',
                    editable: false,
                    autoSelect: true,
                    allowBlank: false,
                    store: new Ext.data.JsonStore(
                    {
                        autoLoad: true,
                        proxy: {
                            type: 'ajax',
                            url: '/api/services/app/inquiry/GetInquiryStatus',
                            reader: {
                                type: 'json',
                                rootProperty: function (node) {
                                    return node.result || node.children;
                                }
                            }
                        },
                        fields: ['value', 'key']
                    }),
                    valueField: 'value',
                    displayField: 'key'
                }
                ,
                {
                    fieldLabel: '起始日期',
                    name: 'Dts'
                },
                {
                    fieldLabel: '截至日期',
                    name: 'Dte'
                }
            ],
            buttons: [
                {
                    text: '开始搜索',
                    handler: 'onStartSearch'
                },
                {
                    text: '清空条件',
                    handler: 'onClearSearch'
                }
            ]
        });

        me.items = [me.form];
        me.callParent(arguments);
    }
});